package com.apchernykh.rozhlasapp.ui.podcasts;

import java.util.List;
import com.apchernykh.ceskyrozhlas.basic.R;
import com.apchernykh.types.PodcastFeedInfo;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class FeedListAdapter extends ArrayAdapter<PodcastFeedInfo>
{
	int iLayoutId;
	public FeedListAdapter(Context iContext, int iTextViewResourceId,
			List<PodcastFeedInfo> iObjects) {
		super(iContext, iTextViewResourceId, iObjects);
		iLayoutId = iTextViewResourceId;
	}

	
	@Override
	public View getView(int iPosition, View iConvertView, ViewGroup iParent) {
		View aRow = iConvertView;
		if (aRow == null) {
			LayoutInflater inflater = ((Activity) getContext())
					.getLayoutInflater();
			aRow = inflater.inflate(iLayoutId, iParent, false);
		}

		TextView aView = (TextView) aRow
				.findViewById(R.id.feedName);
		
		aView.setText(getItem(iPosition).getTitle());
		return aRow;
	}

}